package com.example.common.result;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author YanMing
 * @version 1.0.0
 * @Description TODO
 * @createTime 2021年08月30日 11:26:00
 */
@Data
public class ResponseResultPageLayui<T> implements Serializable {

    private Integer code;
    private String msg;
    /**
     * 总记录数
     */
    private long count;
    private long pages;
    private List<T> data;

    public ResponseResultPageLayui(IPage<T> page){
        //System.out.println("总页数："+page.getPages());
        //System.out.println("总记录数："+page.getTotal());
        //List<T> records = page.getRecords();
        this.code = ResponseCode.SUCCESS.code;
        this.msg = "成功";
        this.count = page.getTotal();
        this.pages = page.getPages();
        this.data = page.getRecords();
    }

}
